scoreboard objectives add rmr.local.n dummy
scoreboard players set #2 rmr.local.n 2

scoreboard objectives add rmr.local.x dummy
scoreboard objectives add rmr.local.y dummy
scoreboard objectives add rmr.local.z dummy

scoreboard objectives add rmr.local.delta_x dummy
scoreboard objectives add rmr.local.delta_y dummy
scoreboard objectives add rmr.local.delta_z dummy

execute store result score @s rmr.local.delta_x run scoreboard players get @s rmr.hitbox.length
execute store result score @s rmr.local.delta_y run scoreboard players get @s rmr.hitbox.height
execute store result score @s rmr.local.delta_z run scoreboard players get @s rmr.hitbox.width

scoreboard players operation @s rmr.local.delta_x /= #2 rmr.local.n
scoreboard players operation @s rmr.local.delta_z /= #2 rmr.local.n

execute store result score @s rmr.local.x run data get entity @s Pos[0] 1000
execute store result score @s rmr.local.y run data get entity @s Pos[1] 1000
execute store result score @s rmr.local.z run data get entity @s Pos[2] 1000

# execute store result storage minecraft:rmr arguments.content int 1 run scoreboard players get @s rmr.local.x
# function rmr:test/console/out with storage minecraft:rmr arguments
# execute store result storage minecraft:rmr arguments.content int 1 run scoreboard players get @s rmr.local.delta_x
# function rmr:test/console/out with storage minecraft:rmr arguments

scoreboard players operation @s rmr.local.x -= @s rmr.local.delta_x
scoreboard players operation @s rmr.local.z -= @s rmr.local.delta_z

data modify storage minecraft:rmr arguments.box_start set value [0d, 0d, 0d]
execute store result score @s rmr.hitbox.self.box_start_x run scoreboard players get @s rmr.local.x
execute store result score @s rmr.hitbox.self.box_start_y run scoreboard players get @s rmr.local.y
execute store result score @s rmr.hitbox.self.box_start_z run scoreboard players get @s rmr.local.z


execute store result score @s rmr.local.x run data get entity @s Pos[0] 1000
execute store result score @s rmr.local.y run data get entity @s Pos[1] 1000
execute store result score @s rmr.local.z run data get entity @s Pos[2] 1000

scoreboard players operation @s rmr.local.x += @s rmr.local.delta_x
scoreboard players operation @s rmr.local.y += @s rmr.local.delta_y
scoreboard players operation @s rmr.local.z += @s rmr.local.delta_z

data modify storage minecraft:rmr arguments.box_end set value [0d, 0d, 0d]
execute store result score @s rmr.hitbox.self.box_end_x run scoreboard players get @s rmr.local.x
execute store result score @s rmr.hitbox.self.box_end_y run scoreboard players get @s rmr.local.y
execute store result score @s rmr.hitbox.self.box_end_z run scoreboard players get @s rmr.local.z

scoreboard objectives remove rmr.local.n
scoreboard objectives remove rmr.local.x
scoreboard objectives remove rmr.local.y
scoreboard objectives remove rmr.local.z
scoreboard objectives remove rmr.local.delta_x
scoreboard objectives remove rmr.local.delta_y
scoreboard objectives remove rmr.local.delta_z